home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Development Tools & Languages / Macintosh Common Lisp Related / 2.01 sources / Library-2.01 / Interfaces / Power.lisp < prev    next >
Encoding:
Text File  |  1993-09-16  |  3.8 KB  |  158 lines  |  [TEXT/CCL2]

  1.  
  2. (in-package :traps)             ; 
  3. ; Created: Sunday, January 6, 1991 at 10:54 PM
  4. ;     Power.p
  5. ;     Pascal Interface to the Macintosh Libraries
  6. ;         Copyright Apple Computer, Inc.    1989-1990
  7. ;         All rights reserved
  8.  
  9. ;;;;;;;;;;;;;
  10. ;
  11. ; Modification History
  12. ;
  13. ; 04/28/93 mwp Release
  14. ; 08/10/92 bill in _AOff & _Boff: "-#xNNN" -> "#x-NNN"
  15. ; ------------- 2.0
  16. ; 08/23/91 bill Remove some return specs in the call form
  17. ;
  18.  
  19. ; $IFC UNDEFINED UsingIncludes
  20. ; $SETC UsingIncludes := 0
  21. ; $ENDC
  22.  
  23. ; $IFC NOT UsingIncludes
  24.  
  25. ; $ENDC
  26.  
  27. ; $IFC UNDEFINED UsingPower
  28. ; $SETC UsingPower := 1
  29.  
  30. ; $I+
  31. ; $SETC PowerIncludes := UsingIncludes
  32. ; $SETC UsingIncludes := 1
  33. ; $IFC UNDEFINED UsingTypes
  34.  
  35. (require-interface 'TYPES)      ; $I $$Shell(PInterfaces)Types.p
  36. ; $ENDC
  37. ; $SETC UsingIncludes := PowerIncludes
  38.  
  39. ;  Bit positions for ModemByte 
  40. (defconstant $modemOnBit 0)
  41. (defconstant $ringWakeUpBit 2)
  42. (defconstant $modemInstalledBit 3)
  43. (defconstant $ringDetectBit 4)
  44. (defconstant $modemOnHookBit 5)
  45.  
  46. ;  masks for ModemByte 
  47. (defconstant $modemOnMask #x1)
  48. (defconstant $ringWakeUpMask #x4)
  49. (defconstant $modemInstalledMask #x8)
  50. (defconstant $ringDetectMask #x10)
  51. (defconstant $modemOnHookMask #x20)
  52.  
  53. ;  bit positions for BatteryByte 
  54. (defconstant $chargerConnBit 0)
  55. (defconstant $hiChargeBit 1)
  56. (defconstant $chargeOverFlowBit 2)
  57. (defconstant $batteryDeadBit 3)
  58. (defconstant $batteryLowBit 4)
  59. (defconstant $connChangedBit 5)
  60.  
  61. ;  masks for BatteryByte 
  62. (defconstant $chargerConnMask #x1)
  63. (defconstant $hiChargeMask #x2)
  64. (defconstant $chargeOverFlowMask #x4)
  65. (defconstant $batteryDeadMask #x8)
  66. (defconstant $batteryLowMask #x10)
  67. (defconstant $connChangedMask #x20)
  68.  
  69. ;  commands to SleepQRec sleepQProc 
  70. (defconstant $sleepRequest 1)
  71. (defconstant $sleepDemand 2)
  72. (defconstant $sleepWakeUp 3)
  73. (defconstant $sleepRevoke 4)
  74.  
  75. ;  SleepQRec.sleepQFlags 
  76. (defconstant $noCalls 1)
  77. (defconstant $noRequest 2)
  78.  
  79. (defconstant $slpQType 16)
  80. (defconstant $sleepQType 16)
  81.  
  82. (def-mactype :modembyte (find-mactype :unsigned-byte))
  83. (def-mactype :batterybyte (find-mactype :unsigned-byte))
  84.  
  85. (def-mactype :pmresultcode (find-mactype :signed-long))
  86.  
  87. (def-mactype :sleepqrecptr (find-mactype :pointer))
  88. (defrecord SleepQRec 
  89.    (sleepQLink (:pointer :sleepqrec))
  90.    (sleepQType :signed-integer) ; type = 16
  91.    (sleepQProc :pointer)        ; Pointer to sleep routine
  92.    (sleepQFlags :signed-integer)
  93.    )
  94.  
  95. (deftrap _idleupdate nil
  96.    (:d0 :signed-long)
  97.    (:register-trap #xA285))
  98.  
  99.  
  100. (deftrap _getcpuspeed nil
  101.    (:d0 :signed-long)
  102.    (:register-trap #xA485 :d0 -1))
  103.  
  104. (deftrap _enableidle nil
  105.    (:d0 :signed-long)
  106.    (:register-trap #xA485 :d0 0))
  107.  
  108.  
  109. (deftrap _disableidle nil
  110.    nil
  111.    (:register-trap #xA485 :d0 1))
  112.  
  113. (deftrap _sleepqinstall ((qrecptr (:pointer :sleepqrec)))
  114.    nil
  115.    (:register-trap #xA28A :a0 qrecptr))
  116.  
  117. (deftrap _sleepqremove ((qrecptr (:pointer :sleepqrec)))
  118.    nil
  119.    (:register-trap #xA48A :a0 qrecptr))
  120.  
  121. (deftrap _aon nil
  122.    nil
  123.    (:register-trap #xA685 :d0 4))
  124.  
  125. (deftrap _aonignoremodem nil
  126.    nil
  127.    (:register-trap #xA685 :d0 5))
  128.  
  129. (deftrap _bon nil
  130.    nil
  131.    (:register-trap #xA685 :d0 0))
  132.  
  133. (deftrap _aoff nil
  134.    nil
  135.    (:register-trap #xA685 :d0 #x-84))
  136.  
  137. (deftrap _boff nil
  138.    nil
  139.    (:register-trap #xA685 :d0 #x-80))
  140.  
  141. ; $ENDC                         ;  UsingPower 
  142.  
  143. ; $IFC NOT UsingIncludes
  144.  
  145. ; $ENDC
  146.  
  147.  
  148. (export '($sleepqtype $slpqtype $norequest $nocalls $sleeprevoke $sleepwakeup
  149.           $sleepdemand $sleeprequest $connchangedmask $batterylowmask
  150.           $batterydeadmask $chargeoverflowmask $hichargemask $chargerconnmask
  151.           $connchangedbit $batterylowbit $batterydeadbit $chargeoverflowbit
  152.           $hichargebit $chargerconnbit $modemonhookmask $ringdetectmask
  153.           $modeminstalledmask $ringwakeupmask $modemonmask $modemonhookbit
  154.           $ringdetectbit $modeminstalledbit $ringwakeupbit $modemonbit))
  155. (provide-interface 'Power)
  156.